package com.xyh.transaction.meilisearch;

import com.meilisearch.sdk.Client;
import com.meilisearch.sdk.Config;
import com.meilisearch.sdk.exceptions.MeilisearchException;
import com.meilisearch.sdk.model.TaskInfo;

public class DeleteMeilisearchTest {

    public static void main(String[] args) throws MeilisearchException {

        DeleteMeilisearchTest deleteMeilisearchTest = new DeleteMeilisearchTest();

        deleteMeilisearchTest.delete();

    }


    public void delete() throws MeilisearchException {
        Client client = new Client(new Config("http://localhost:7700", "aSampleMasterKey"));

//        Client client = new Client(new Config("http://124.223.56.87:7700", "aSampleMasterKey"));


        client.getIndex("movies").deleteAllDocuments();

        TaskInfo taskInfo = client.deleteIndex("movies");

        System.out.println("Status: " + taskInfo.getStatus());
        System.out.println("Task UID: " + taskInfo.getTaskUid());
        System.out.println("Type: " + taskInfo.getType());
        System.out.println("Index UID: " + taskInfo.getIndexUid());
        System.out.println("Enqueued At: " + taskInfo.getEnqueuedAt());
    }


}
